<template>
    <div id="cc">
        <div style="position: sticky;top:0;z-index: 9999;background: #fff;">
            <div style="display: flex;flex-direction: row;height: 40px;">
                <div
                        style="display: flex;justify-content: center;align-items: center;width: 25vw;
                        font-family: PingFangSC-Regular;font-size: 14px;"
                        :style="{borderBottom:activeStep==index?'2px solid #454592':'1px solid #ddd',color:activeStep==index?'#454592':'#333'}"
                        v-for="(item,index) in ['基本','疾病','合病症','治疗']"
                        @click="privilegeHeadClick('anchor-'+index)">
                    <span>
                      {{item}}
                    </span>
                </div>
            </div>
        </div>
        <div class="wrapper" id="section">
            <!--基本信息-->
            <div id="anchor-0" class="privilege-wrap">
                <!--标题-->
                <div class="title">
                    <div class="title_block"></div>
                    <div class="title_text">
                        基本信息
                    </div>
                </div>
                <!--field-->
                <div class="field_item">
                    <div class="field_title">
                        年龄
                    </div>
                    <div>
                        <Field v-model="form.tabBasic.B02" type="number"/>
                    </div>
                </div>
                <div class="field_item">
                    <div class="field_title">
                        性别
                    </div>
                    <div>
                        <Cell is-link :title="form.tabBasic.B03" @click="genderShow=true"/>
                    </div>
                </div>
                <div class="field_item">
                    <div class="field_title">
                        地点
                    </div>
                    <div>
                        <Cell is-link :title="form.tabBasic.B01" @click="locationShow=true"/>
                    </div>
                </div>
                <div class="field_item">
                    <div class="field_title">
                        病程（年）
                    </div>
                    <div>
                        <Cell is-link :title="form.tabBasic.B06" @click="diseaseageShow=true"/>
                    </div>
                </div>
            </div>
            <Overlay :show="genderShow">
                <RadioList :fullList="genderOptions" :checked="form.tabBasic.B03" @confirm="genderConfirm"
                           @cancel="genderShow=false"/>
            </Overlay>
            <Overlay :show="locationShow">
                <RadioList :fullList="locationOptions" :checked="form.tabBasic.B01" @confirm="locationConfirm"
                           @cancel="locationShow=false"/>
            </Overlay>
            <Overlay :show="diseaseageShow">
                <RadioList :fullList="diseaseageOptions" :checked="form.tabBasic.B06" @confirm="diseaseageConfirm"
                           @cancel="diseaseageShow=false"/>
            </Overlay>
            <!--基本信息-->
            <!--疾病信息-->
            <div class="mt20 privilege-wrap" id="anchor-1">
                <!--标题-->
                <div class="title">
                    <div class="title_block"></div>
                    <div class="title_text">
                        疾病信息
                    </div>
                </div>
                <!--field-->
                <div class="field_item" v-if="!form.tabComplication.C15.includes('卒中') && !form.tabComplication.C15.includes('冠心病')">
                    <div class="field_title">
                        尿蛋白定性检测
                    </div>
                    <div>
                        <Cell is-link :title="form.tabDisease.D12" @click="qaoupShow=true"/>
                    </div>
                </div>
                <div class="field_item">
                    <div class="field_title">
                        舒张压(mmHg)
                    </div>
                    <div>
                        <Field v-model="form.tabDisease.D04" type="number"/>
                    </div>
                </div>
                <div class="field_item">
                    <div class="field_title">
                        收缩压(mmHg)
                    </div>
                    <div>
                        <Field v-model="form.tabDisease.D05" type="number"/>
                    </div>
                </div>
                <div class="field_item">
                    <div class="field_title">
                        诊断
                    </div>
                    <div>
                        <Cell is-link :title="form.tabDisease.D09" @click="diagnosisShow=true"/>
                    </div>
                </div>
                <div class="field_item" v-if="!form.tabComplication.C15.includes('卒中') && !form.tabComplication.C15.includes('冠心病')">
                    <div class="field_title">
                        尿白蛋白/肌酐比值（mg/g）
                    </div>
                    <div>
                        <Cell is-link :title="form.tabDisease.D10" @click="uacrShow=true"/>
                    </div>
                </div>
                <div class="field_item" v-if="!form.tabComplication.C15.includes('卒中') && !form.tabComplication.C15.includes('冠心病')">
                    <div class="field_title">
                        尿白蛋白定量检测（mg/24h）
                    </div>
                    <div>
                        <Cell is-link :title="form.tabDisease.D11" @click="uaqShow=true"/>
                    </div>
                </div>
                <Overlay :show="qaoupShow">
                    <RadioList :fullList="qaoupOptions" :checked="form.tabDisease.D12" @confirm="qaoupConfirm"
                               @cancel="qaoupShow=false"/>
                </Overlay>
                <Overlay :show="diagnosisShow">
                    <RadioList :fullList="diagnosisOptions" :checked="form.tabDisease.D09" @confirm="diagnosisConfirm"
                               @cancel="diagnosisShow=false"/>
                </Overlay>
                <Overlay :show="uacrShow">
                    <RadioList :fullList="uacrOptions" :checked="form.tabDisease.D10" @confirm="uacrConfirm"
                               @cancel="uacrShow=false"/>
                </Overlay>
                <Overlay :show="uaqShow">
                    <RadioList :fullList="uaqOptions" :checked="form.tabDisease.D11" @confirm="uaqConfirm"
                               @cancel="uaqShow=false"/>
                </Overlay>
            </div>
            <!--疾病信息-->
            <!--合并症信息-->
            <div class="mt20 privilege-wrap" id="anchor-2">
                <!--标题-->
                <div class="title">
                    <div class="title_block"></div>
                    <div class="title_text">
                        合并症信息
                    </div>
                </div>
                <!--field-->
                <div class="field_item">
                    <div class="field_title">
                        伴发疾病及既往史（可多选）
                    </div>
                    <div>
                        <Cell is-link :title="form.tabComplication.C15.join(',')" @click="diseaseHistoryShow=true"/>
                    </div>
                </div>
                <div v-if="form.tabComplication.C15.includes('ACS')">
                    <div class="title_sub">
                        急性冠状脉综合症
                    </div>
                    <div class="field_item" >
                        <div class="field_title">
                            目前状态
                        </div>
                        <div>
                            <Cell is-link :title="form.tabComplication.C07" @click="currentStatusShow=true"/>
                        </div>
                    </div>
                    <div class="field_item" v-if="form.tabComplication.C07 == '急性发作'">
                        <div class="field_title">
                            急性期治疗方案
                        </div>
                        <div>
                            <Cell is-link :title="form.tabComplication.C09" @click="acuteplanShow=true"/>
                        </div>
                    </div>
                    <div class="field_item" v-if="form.tabComplication.C07 == '急性发作'">
                        <div class="field_title">
                            心电图（可多选）
                        </div>
                        <div>
                            <Cell is-link :title="form.tabComplication.C08.join(',')" @click="ecgShow=true"/>
                        </div>
                    </div>
                </div>
                <div v-if="form.tabComplication.C15.includes('慢性肾脏疾病')">
                    <div class="title_sub">
                        慢性肾脏疾病
                    </div>
                    <div class="field_item">
                        <div class="field_title">
                            透析方式
                        </div>
                        <div>
                            <Cell is-link :title="form.tabComplication.C04" @click="dialysisShow=true"/>
                        </div>
                    </div>
                    <div class="field_item" v-if="form.tabComplication.C04 != '未透析'">
                        <div class="field_title">
                            血磷水平（mmol/L)
                        </div>
                        <div>
                            <Field v-model="form.tabComplication.C06" type="number"/>
                        </div>
                    </div>
                    <div class="field_item" v-if="form.tabComplication.C04 != '未透析'">
                        <div class="field_title">
                            血钙水平(mmol/L)
                        </div>
                        <div>
                            <Field v-model="form.tabComplication.C05" type="number"/>
                        </div>
                    </div>
                </div>

                <div v-if="form.tabComplication.C15.includes('糖尿病')">
                    <div class="title_sub">
                        糖尿病
                    </div>
                    <div class="field_item">
                        <div class="field_title">
                            当前治疗方案
                        </div>
                        <div>
                            <Cell is-link :title="form.tabComplication.C01"
                                  @click="currentTherapeuticShow=true"/>
                        </div>
                    </div>
                    <div class="field_item" v-if="form.tabComplication.C01 == '仅OAD'">
                        <div class="field_title">
                            仅二甲双胍控制
                        </div>
                        <div>
                            <Cell is-link :title="form.tabComplication.C02"
                                  @click="metformincontrolShow=true"/>
                        </div>
                    </div>
                    <div class="field_item">
                        <div class="field_title">
                            空腹血糖(mmol/L)
                        </div>
                        <div>
                            <Field v-model="form.tabComplication.C10" type="number"/>
                        </div>
                    </div>
                    <div class="field_item">
                        <div class="field_title">
                            餐后血糖(mmol/L)
                        </div>
                        <div>
                            <Field v-model="form.tabComplication.C11" type="number"/>
                        </div>
                    </div>
                    <div class="field_item">
                        <div class="field_title">
                            糖化血红蛋白(%)
                        </div>
                        <div>
                            <Field v-model="form.tabComplication.C12" type="number"/>
                        </div>
                    </div>
                </div>

                <Overlay :show="diseaseHistoryShow">
                    <CheckboxList :fullList="diseaseHistoryOptions" :checked="form.tabComplication.C15"
                                  @confirm="diseaseHistoryconfirm" @cancel="diseaseHistoryShow = false"/>
                </Overlay>
                <Overlay :show="currentStatusShow">
                    <RadioList :fullList="currentStatusOptions" :checked="form.tabComplication.C07"
                               @confirm="currentStatusConfirm"
                               @cancel="currentStatusShow=false"/>
                </Overlay>
                <Overlay :show="acuteplanShow">
                    <RadioList :fullList="acuteplanOptions" :checked="form.tabComplication.C09"
                               @confirm="acuteplanConfirm"
                               @cancel="acuteplanShow=false"/>
                </Overlay>
                <Overlay :show="ecgShow">
                    <CheckboxList :fullList="ecgOptions" :checked="form.tabComplication.C08"
                                  @confirm="ecgConfirm" @cancel="ecgShow = false"/>
                </Overlay>
                <Overlay :show="dialysisShow">
                    <RadioList :fullList="dialysisOptions" :checked="form.tabComplication.C04"
                               @confirm="dialysisConfirm"
                               @cancel="dialysisShow=false"/>
                </Overlay>
                <Overlay :show="currentTherapeuticShow">
                    <RadioList :fullList="currentTherapeuticOption" :checked="form.tabComplication.C01"
                               @confirm="currentTherapeuticConfirm"
                               @cancel="currentTherapeuticShow=false"/>
                </Overlay>
                <Overlay :show="metformincontrolShow">
                    <RadioList :fullList="metformincontrolOptions" :checked="form.tabComplication.C02"
                               @confirm="metformincontrolConfirm"
                               @cancel="metformincontrolShow=false"/>
                </Overlay>
            </div>
            <!--合并症信息-->
            <!--治疗信息-->
            <div class="mt20 privilege-wrap" id="anchor-3">
                <!--标题-->
                <div class="title">
                    <div class="title_block"></div>
                    <div class="title_text">
                        治疗信息
                    </div>
                </div>
                <!--field-->
                <div class="field_item" v-if="form.tabBasic.B06 != '新诊断'">
                    <div class="field_title">
                        上次治疗方案（可多选）
                    </div>
                    <div>
                        <Cell is-link :title="form.treatment.T09.join(',')" @click="lastplanShow=true"/>
                    </div>
                </div>
                <div class="field_item">
                    <div class="field_title">
                        当前方案（可多选）
                    </div>
                    <div>
                        <Cell is-link :title="form.treatment.T05.join(',')" @click="currentplanShow=true"/>
                    </div>
                </div>
                <div class="field_item">
                    <div class="field_title">
                        目前剂量（mg）
                    </div>
                    <div>
                        <Cell is-link :title="form.treatment.T06"
                              @click="aprovel_co_recommand_diagnoseShow=true"/>
                    </div>
                </div>
                <div class="field_item">
                    <div class="field_title">
                        建议用药时间（月）
                    </div>
                    <div>
                        <Cell is-link :title="form.treatment.T08"
                              @click="aprovel_co_recommand_timeShow=true"/>
                    </div>
                </div>
                <Overlay :show="lastplanShow">
                    <CheckboxList :fullList="lastplanOptions" :checked="form.treatment.T09"
                                  @confirm="lastplanConfirm" @cancel="lastplanShow = false"/>
                </Overlay>
                <Overlay :show="currentplanShow">
                    <CheckboxList :fullList="currentplanOptions" :checked="form.treatment.T05"
                                  @confirm="currentplanConfirm" @cancel="currentplanShow = false"/>
                </Overlay>
                <Overlay :show="aprovel_recommand_timeShow">
                    <RadioList :fullList="aprovel_recommand_timeOptions" :checked="form.treatment.T08" @confirm="aprovel_recommand_timeConfirm"
                               @cancel="aprovel_recommand_timeShow=false"/>
                </Overlay>
                <Overlay :show="aprovel_recommand_diagnoseShow">
                    <RadioList :fullList="aprovel_recommand_diagnoseOption" :checked="form.treatment.T06" @confirm="aprovel_recommand_diagnoseConfirm"
                               @cancel="aprovel_recommand_diagnoseShow=false"/>
                </Overlay>
            </div>
            <!--治疗信息-->
            <!--保存按钮-->
            <div class="submit">
                <div class="submit_btn" @click="save">
                    保存
                </div>
            </div>
            <div class="submit_btn2" @click="submit">
                提交
            </div>
        </div>
        <div>
            <img :src="cloud_img" style="width: 100%"/>
        </div>
    </div>

</template>

<script>
    import {Field, Cell, Popup, Picker, Toast, Overlay, Checkbox, CheckboxGroup, CellGroup} from 'vant';
    import cloud_img from '@assets/image/cloud.svg'
    import RadioList from "@components/snfRadioList/index";
    import CheckboxList from "@components/snfCheckboxList/index";
    const genderOptions = ['男', '女']
    const locationOptions = ['病房', '门诊']
    const diseaseHistoryOptions = ['糖尿病', '慢性肾脏疾病', '卒中', '急性冠脉综合征', '冠心病', 'ACS', '其他', '无']
    const diseaseageOptions = ['新诊断', '<2', '2-4', '4-6', '6-8', '8-10', '≥10']
    const qaoupOptions = ['-', '±', '+', '++', '+++', '++++', '未检测']
    const diagnosisOptions = ['1级高血压', '2级高血压', '3级高血压']
    const uacrOptions = ['<30', '30-300', '>300', '未检测']
    const uaqOptions = ['<30', '30-300', '>300', '未检测']
    const currentStatusOptions = ['急性发作', '既往史']
    const acuteplanOptions = ['PCI', '非PCI']
    const ecgOptions = ['ST抬高', 'ST压低', 'T波倒置', '病理性Q波', '无明显变化']
    const dialysisOptions = ['未透析', '血液透析', '腹膜透析', '其他透析方式']
    const currentTherapeuticOption = ['新诊断/未治疗', '仅OAD', '基础+OAD', '基础追加', '基础餐时', '短期强化', '其他']
    const metformincontrolOptions = ['是', '否']
    const lastplanOptions = ['ARB', 'CCB', 'ACEI', '利尿剂', 'β受体阻滞剂', '其他', '未治疗']
    const currentplanOptions = ['安博维®', '安博诺®', 'CCB', '利尿剂', 'β受体阻滞剂', '其他']
    const aprovel_co_recommand_timeOptions = ['<1', '1-3', '3-6', '6-12', '≥12']
    const aprovel_co_recommand_diagnoseOption = ['安博维：150', '安博维：300', '安博诺：150/12.5mg', '安博诺：300/25mg']
    export default {
        name: "add",
        props: {
            scheduleId: String,
            tabActive: Number
        },
        components: {
            CheckboxList,
            RadioList,
            Field,
            Cell,
            Popup,
            Picker,
            Toast,
            Overlay, Checkbox, CheckboxGroup, CellGroup
        },
        data() {
            return {
                activeStep: '',
                form: {
                    finish: false,
                    callPlanId: this.scheduleId,
                    prodName: '安博诺',
                    prodId: 'APROVE_CO',
                    tabBasic: {
                        B02: '',
                        B03: '',
                        B01: '',
                        B06: '',

                    },
                    tabDisease: {
                        D04:'',
                        D05:'',
                        D12: '',
                        D09: '',
                        D10: '',
                        D11: '',

                    },
                    tabComplication: {
                        C15: [],
                        C07: '',
                        C09: '',
                        C08: [],
                        C04: '',
                        C06: '',
                        C05: '',
                        C01: '',
                        C02: '',
                        C10: '',
                        C11: '',
                        C12: ''
                    },
                    treatment: {
                        T09: [],
                        T05: [],
                        T06: '',
                        T08: ''
                    }
                },
                genderShow: false,
                locationShow: false,
                diseaseageShow: false,
                qaoupShow: false,
                diagnosisShow: false,
                uacrShow: false,
                uaqShow: false,
                diseaseHistoryShow: false,
                currentStatusShow: false,
                acuteplanShow: false,
                ecgShow: false,
                dialysisShow: false,
                currentTherapeuticShow: false,
                metformincontrolShow: false,
                lastplanShow: false,
                currentplanShow: false,
                aprovel_co_recommand_diagnoseShow: false,
                aprovel_co_recommand_timeShow: false,
                genderOptions: genderOptions,
                locationOptions: locationOptions,
                diseaseageOptions: diseaseageOptions,
                qaoupOptions: qaoupOptions,
                diagnosisOptions: diagnosisOptions,
                uacrOptions: uacrOptions,
                uaqOptions: uaqOptions,
                diseaseHistoryOptions: diseaseHistoryOptions,
                currentStatusOptions: currentStatusOptions,
                acuteplanOptions: acuteplanOptions,
                ecgOptions: ecgOptions,
                dialysisOptions: dialysisOptions,
                currentTherapeuticOption: currentTherapeuticOption,
                metformincontrolOptions: metformincontrolOptions,
                lastplanOptions: lastplanOptions,
                currentplanOptions: currentplanOptions,
                aprovel_co_recommand_timeOptions: aprovel_co_recommand_timeOptions,
                aprovel_co_recommand_diagnoseOption: aprovel_co_recommand_diagnoseOption,
                cloud_img: cloud_img
            }
        },
        methods: {
            currentplanConfirm(value, index) {
                this.form.treatment.T05 = value
                this.currentplanShow = false
            },
            lastplanConfirm(value, index) {
                this.form.treatment.T09 = value
                this.lastplanShow = false
            },
            ecgConfirm(value, index) {
                this.form.tabComplication.C08 = value
                this.ecgShow = false
            },
            diseaseHistoryconfirm(value, index) {
                this.form.tabComplication.C15 = value
                this.diseaseHistoryShow = false
            },
            onScroll(e) {
                let scrollItems = document.querySelectorAll(".privilege-wrap");
                for (let i = scrollItems.length - 1; i >= 0; i--) {
                    // 判断滚动条滚动距离是否大于当前滚动项可滚动距离
                    let judge =
                        e.target.scrollTop >=
                        scrollItems[i].offsetTop - scrollItems[0].offsetTop;
                    if (judge) {
                        this.activeStep = i;
                        this.active = this.activeStep
                        break;
                    }
                }
            },
            privilegeHeadClick(anchor) {
                this.$nextTick(() => {
                    document.querySelector(`#${anchor}`).scrollIntoView({
                        behavior: "smooth", // 平滑过渡
                        block: "start" // 上边框与视窗顶部平齐。默认值
                    });
                });
            },
            aprovel_co_recommand_diagnoseConfirm(value, index) {
                this.form.treatment.T06 = value
                this.aprovel_co_recommand_diagnoseShow = false
            },
            aprovel_co_recommand_timeConfirm(value, index) {
                this.form.treatment.T08 = value
                this.aprovel_co_recommand_timeShow = false
            },
            currentTherapeuticConfirm(value, index) {
                this.form.tabComplication.C01 = value
                this.currentTherapeuticShow = false
            },
            metformincontrolConfirm(value, index) {
                this.form.tabComplication.C02 = value
                this.metformincontrolShow = false
            },
            dialysisConfirm(value, index) {
                this.form.tabComplication.C04 = value
                this.dialysisShow = false
            },
            acuteplanConfirm(value, index) {
                this.form.tabComplication.C09 = value
                this.acuteplanShow = false
            },
            ecgToggle(index) {
                this.$refs.ecgcheckboxes[index].toggle();
            },
            currentStatusConfirm(value, index) {
                this.form.tabComplication.C07 = value
                this.currentStatusShow = false
            },
            uaqConfirm(value, index) {
                this.form.tabDisease.D11 = value
                this.uaqShow = false
            },
            uacrConfirm(value, index) {
                this.form.tabDisease.D10 = value
                this.uacrShow = false
            },
            diagnosisConfirm(value, index) {
                this.form.tabDisease.D09 = value
                this.diagnosisShow = false
            },
            qaoupConfirm(value, index) {
                this.form.tabDisease.D12 = value
                this.qaoupShow = false
            },
            diseaseageConfirm(value, index) {
                this.form.tabBasic.B06 = value
                this.diseaseageShow = false
            },
            genderConfirm(value, index) {
                this.form.tabBasic.B03 = value
                this.genderShow = false
            },
            locationConfirm(value, index) {
                this.form.tabBasic.B01 = value
                this.locationShow = false
            },
            toggle(index) {
                this.$refs.checkboxes[index].toggle();
            },
            lastplantoggle(index) {
                this.$refs.lastplancheckboxes[index].toggle();
            },
            currentplantoggle(index) {
                this.$refs.currentplancheckboxes[index].toggle();
            },
            saveCheck(){

                if(!this.form.tabBasic.B01){
                    alert("请选择地点！")
                    return false
                }
                if(!this.form.tabBasic.B02){
                    alert("请输入年龄！")
                    return false
                }
                if(!this.form.tabBasic.B03){
                    alert("请选择性别！")
                    return false
                }
                if(!this.form.tabBasic.B06){
                    alert("请选择病程！")
                    return false
                }
                if(!this.form.tabDisease.D04){
                    alert("请输入收缩压！")
                    return false
                }
                if(!this.form.tabDisease.D05){
                    alert("请输入舒张压！")
                    return false
                }

                if(this.form.tabComplication.C15.length<1){
                    alert("请选择伴发疾病及既往史！")
                    return false
                }

                if(!this.form.tabComplication.C15.includes('卒中','冠心病')){
                    if(!this.form.tabDisease.D10){
                        alert("请选择尿白蛋白/肌酐比值！")
                        return false
                    }
                    if(!this.form.tabDisease.D11){
                        alert("请选择尿白蛋白定量检测！")
                        return false
                    }
                    if(!this.form.tabDisease.D12){
                        alert("请选择尿蛋白定性检测！")
                        return false
                    }
                }

                if(!this.form.tabDisease.D09){
                    alert("请选择诊断！")
                    return false
                }

                if(this.form.tabComplication.C15.includes('糖尿病')){
                    if(!this.form.tabComplication.C01){
                        alert("请选择当前治疗方案！")
                        return false
                    }
                    if(!this.form.tabComplication.C10){
                        alert("请输入空腹血糖！")
                        return false
                    }
                    if(!this.form.tabComplication.C11){
                        alert("请输入餐后血糖！")
                        return
                    }
                    if(!this.form.tabComplication.C12){
                        alert("请输入糖化血红蛋白！")
                        return false
                    }
                }

                if(this.form.tabComplication.C01 == '仅OAD'){
                    if(!this.form.tabComplication.C02){
                        alert("请选择仅二甲双胍控制！")
                        return false
                    }
                }

                if(this.form.tabComplication.C15.includes('ACS')){
                    if(!this.form.tabComplication.C07){
                        alert("请选择目前状态！")
                        return false
                    }
                }

                if(this.form.tabComplication.C07 =='急性发作'){
                    if(!this.form.tabComplication.C09){
                        alert("请选择急性期治疗方案！")
                        return false
                    }
                    if(this.form.tabComplication.C08.length<1){
                        alert("请选择心电图！")
                        return false
                    }
                }

                if(this.form.tabComplication.C15.includes('慢性肾脏疾病')){
                    if(!this.form.tabComplication.C04){
                        alert("请选择透析方式！")
                        return false
                    }
                    if(this.form.tabComplication.C04 != '未透析'){
                        if(!this.form.tabComplication.C05){
                            alert("请输入血钙水平！")
                            return false
                        }
                        if(!this.form.tabComplication.C06){
                            alert("请输入血磷水平！")
                            return false
                        }
                    }
                }

                if(this.form.tabBasic.B06 != '新诊断'){
                    if(this.form.treatment.T09.length<1){
                        alert("请选择上次治疗方案！")
                        return false
                    }
                }

                if(this.form.treatment.T05.length<1){
                    alert("请选择当前方案！")
                    return false
                }

                if(!this.form.treatment.T06){
                    alert("请选择目前剂量！")
                    return false
                }

                if(!this.form.treatment.T08){
                    alert("请选择建议用药时间 ")
                    return false
                }
                return true
            },
            save() {
                this.form.finish = false
                this.$emit('save', Object.assign({}, this.form))
                this.$nextTick(() => {
                    document.querySelector(`#cc`).scrollIntoView({
                        block: "start" // 上边框与视窗顶部平齐。默认值
                    });
                });
                this.form = {
                    finish: false,
                    callPlanId: this.scheduleId,
                    prodName: '安博诺',
                    prodId: 'APROVE_CO',
                    tabBasic: {
                        B02: '',
                        B03: '',
                        B01: '',
                        B06: '',

                    },
                    tabDisease: {
                        D04:'',
                        D05:'',
                        D12: '',
                        D09: '',
                        D10: '',
                        D11: '',

                    },
                    tabComplication: {
                        C15: [],
                        C07: '',
                        C09: '',
                        C08: [],
                        C04: '',
                        C06: '',
                        C05: '',
                        C01: '',
                        C02: '',
                        C10: '',
                        C11: '',
                        C12: ''
                    },
                    treatment: {
                        T09: [],
                        T05: [],
                        T06: '',
                        T08: ''
                    }
                }
                this.$emit('hide')
            },
            submit(){
                this.form.finish = this.saveCheck()
                if(this.form.finish){
                    this.$emit('save', Object.assign({}, this.form))
                    this.$emit('hide')
                }else{
                    return
                }
                this.$nextTick(() => {
                    document.querySelector(`#cc`).scrollIntoView({
                        block: "start" // 上边框与视窗顶部平齐。默认值
                    });
                });
                this.form = {
                    finish: false,
                    callPlanId: this.scheduleId,
                    prodName: '安博诺',
                    prodId: 'APROVE_CO',
                    tabBasic: {
                        B02: '',
                        B03: '',
                        B01: '',
                        B06: '',

                    },
                    tabDisease: {
                        D04:'',
                        D05:'',
                        D12: '',
                        D09: '',
                        D10: '',
                        D11: '',

                    },
                    tabComplication: {
                        C15: [],
                        C07: '',
                        C09: '',
                        C08: [],
                        C04: '',
                        C06: '',
                        C05: '',
                        C01: '',
                        C02: '',
                        C10: '',
                        C11: '',
                        C12: ''
                    },
                    treatment: {
                        T09: [],
                        T05: [],
                        T06: '',
                        T08: ''
                    }
                }
            }
        },
        mounted() {
        },
        watch: {
            tabActive(newval, oldval) {
                this.activeStep = newval
            },
            'form.tabComplication.C15':{
                handler(newval,oldval){
                    if(newval.includes('卒中','冠心病')){
                        this.form.tabDisease.D10 = ''
                        this.form.tabDisease.D11 = ''
                        this.form.tabDisease.D12 = ''
                    }
                    if(!newval.includes('糖尿病')){
                        this.form.tabComplication.C01 = ''
                        this.form.tabComplication.C10 = ''
                        this.form.tabComplication.C11 = ''
                        this.form.tabComplication.C12 = ''
                    }
                    if(!newval.includes('慢性肾脏疾病')){
                        this.form.tabComplication.C04 = ''
                    }
                    if(!newval.includes('ACS')){
                        this.form.tabComplication.C07 = ''
                    }
                },
                deep: true,
                immediate: true
            },
            'form.tabComplication.C01':{
                handler(newval,oldval){
                    if(newval != '仅OAD'){
                        this.form.tabComplication.C02 = ''
                    }
                },
                deep: true,
                immediate: true
            },
            'form.tabComplication.C04':{
                handler(newval,oldval){
                    if(newval == '未透析'){
                        this.form.tabComplication.C05 = ''
                        this.form.tabComplication.C06 = ''
                    }
                },
                deep: true,
                immediate: true
            },
            'form.tabComplication.C07':{
                handler(newval,oldval){
                    if(newval != '急性发作'){
                        this.form.tabComplication.C08 = []
                        this.form.tabComplication.C09 = ''
                    }
                },
                deep: true,
                immediate: true
            },
            'form.tabBasic.B06':{
                handler(newval,oldval){
                    if(newval == '新诊断'){
                        this.form.treatment.T09 = []
                    }
                }
            }
        }
    }
</script>

<style scoped>
    .wrapper {
        padding: 20px;
    }

    .title {
        display: flex;
        flex-direction: row;
        align-items: center;
        /*margin-bottom: 10px;*/
    }

    .title_block {
        background: #ACB318;
        width: 4px;
        height: 20px;
    }

    .title_text {
        font-family: PingFangSC-Semibold;
        font-size: 16px;
        color: #333333;
        letter-spacing: 0.3px;
        text-align: justify;
        line-height: 24px;
        margin-left: 12px;
    }

    .field_title {
        font-family: PingFangSC-Regular;
        font-size: 12px;
        color: #999999;
        letter-spacing: 0.22px;
        text-align: justify;
        line-height: 16px;
    }

    .field_item {
        margin-top: 10px;
    }

    .submit {
        width: 100%;
        height: 48px;
        display: flex;
        justify-content: center;
        margin-top: 50px;
        margin-bottom: 20px;
    }
    .submit_btn2{
        width: 90%;
        height: 48px;
        background: #ACB318;
        border-radius: 2px;
        border-radius: 2px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        margin: 0 auto;
    }
    .mt20 {
        margin-top: 20px;
    }

    .submit_btn {
        width: 90%;
        height: 48px;
        background: #454592;
        border-radius: 2px;
        border-radius: 2px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
    }

    .title_sub {
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #454592;
        letter-spacing: 0.26px;
        text-align: justify;
        margin-top: 20px;
    }

    .mt20 {
        margin-top: 20px;
    }

    .van-cell {
        padding: 10px 0px !important;
        border-bottom: 1px solid #ddd;
    }
</style>